<?php


/**
 * Description of actionEnterFood
 *
 * @author MariiTeheran
 */

class actionsEnterFood {
    
    private $conx;
    private $food = "SELECT max(foodcod) FROM FOOD";
    private $foodnum = 0;
      
    public function __construct() {
        $this->conx = null;
    }
    
    public function thisfood(){
        $consult = sprintf($this->food, $num);
        $this->conx = new conexion();
        $result = pg_exec($this->conx->getConexionDB(), $consult);
        $this->conx->closeConexionDB();
        $this->conx = null;
        $date = pg_fetch_assoc($result);
        $val = $date['max'];
        if($val == " "){
            $this->foodnum = 1;
        } else {
            $this->foodnum = $val + 1;
        }
        return $this->foodnum;
    }
}

?>
